from flask import redirect,url_for,session
from functools import wraps

def login_required(func):

    @wraps(func)
    def hello(*args,**kwargs):
        user_id=session.get('user_id')
        if not user_id:
            return redirect(url_for('register'))
        else:
            return func(*args,**kwargs)
    return hello

